package com.kaiwukj.android.ufamily.mvp.http.entity.result;

import com.kaiwukj.android.ufamily.mvp.http.entity.base.BaseBean;

import java.text.DecimalFormat;

public class OrderResult extends BaseBean {
    /**
     * "id": 12,
     * "orderNum": "20200401082839",
     * "serviceName": "日常保洁",
     * "serviceParameterName": "日常保洁3",
     * "thumbnail": null,
     * "serviceType": "0",
     * "num": 1,
     * "orderPrice": 136,
     * "couponPrice": 0,
     * "actualPrice": 136,
     * "appointmentTime": "2020-04-01 08:32:31",
     * "status": 3, //0：未支付 1：接单中 2：待服务 3：服务中 4：待评价 5：已评价 6:已取消
     * "exceptionStatus": 0,
     * "refundStatus": 0,//退款状态 0->待处理（默认可申请退款）；1->退款中；2->已完成；3->已拒绝
     * "createTime": "2020-04-10 13:3
     */

    private Integer id;
    private String orderNum;
    private String serviceName;
    private Integer serviceParameterId;
    private String serviceParameterName;
    private String thumbnail;
    private String serviceType;
    private Integer num;
    private Double orderPrice;
    private Double unitPrice;
    private Double couponPrice;
    private Double actualPrice;
    private String appointmentTime;
    private Integer status;
    private Integer exceptionStatus;
    private Integer refundStatus;
    private String refundFailReason;
    private String updateTime;
    private String createTime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public Integer getServiceParameterId() {
        return serviceParameterId;
    }

    public void setServiceParameterId(Integer serviceParameterId) {
        this.serviceParameterId = serviceParameterId;
    }

    public String getServiceParameterName() {
        return serviceParameterName;
    }

    public void setServiceParameterName(String serviceParameterName) {
        this.serviceParameterName = serviceParameterName;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public String getServiceType() {
        return serviceType;
    }

    public void setServiceType(String serviceType) {
        this.serviceType = serviceType;
    }

    public Integer getNum() {
        return num == null ? 0 : num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Double getOrderPrice() {
        return orderPrice == null ? 0 : orderPrice;
    }

    public void setOrderPrice(Double orderPrice) {
        this.orderPrice = orderPrice;
    }

    public String getOrderPriceStr() {
        return getFormatPrice(getOrderPrice());
    }

    public Double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(Double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public Double getCouponPrice() {
        return couponPrice == null ? 0 : couponPrice;
    }

    public void setCouponPrice(Double couponPrice) {
        this.couponPrice = couponPrice;
    }

    public String getCouponPriceStr() {
        return getFormatPrice(getCouponPrice());
    }

    public Double getActualPrice() {
        return actualPrice == null ? 0 : actualPrice;
    }

    public void setActualPrice(Double actualPrice) {
        this.actualPrice = actualPrice;
    }

    public String getActualPriceStr() {
        DecimalFormat df = new DecimalFormat("0.00");
        return df.format(getActualPrice());
    }

    public String getAppointmentTime() {
        return appointmentTime;
    }

    public void setAppointmentTime(String appointmentTime) {
        this.appointmentTime = appointmentTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    //设置订单已取消(订单失效)
    public void setInvalid() {
        setStatus(6);
    }

    public String getStatusStr() {
        if (getStatus() == 0) return "待付款";
        else if (getStatus() == 1) return "待服务";
        else if (getStatus() == 2) return "待服务";
        else if (getStatus() == 3) return "服务中";
        else if (getStatus() == 4) return "已完成";
        else if (getStatus() == 5) return "已完成";
        else if (getStatus() == 6) return "已取消";
        else return "未知";
    }

    public Integer getExceptionStatus() {
        return exceptionStatus;
    }

    public void setExceptionStatus(Integer exceptionStatus) {
        this.exceptionStatus = exceptionStatus;
    }

    public Integer getRefundStatus() {
        return refundStatus;
    }

    public String getRefundStatusStr() {
        if (getRefundStatus() == 1) {
            return "审核中";
        } else if (getRefundStatus() == 2) {
            return "已退款";
        } else {
            return "退款失败";
        }
    }

    public String getRefundFailReason() {
        return refundFailReason;
    }

    public void setRefundFailReason(String refundFailReason) {
        this.refundFailReason = refundFailReason;
    }

    public void setRefundStatus(Integer refundStatus) {
        this.refundStatus = refundStatus;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getFormatPrice(Double price) {
        DecimalFormat df = new DecimalFormat("0.00");
        return df.format(price);
    }
}
